package View;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;

import Controller.ControladorProveedor;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class GesionarProveedor extends JFrame {

	private JPanel contentPane;
	private JTextField textFieldDir;
	private JTextField textFieldNombre;
	private JTextField textFieldCed;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					GesionarProveedor frame = new GesionarProveedor();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public GesionarProveedor() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JPanel panel = new JPanel();
		contentPane.add(panel, BorderLayout.CENTER);
		panel.setLayout(null);
		
		JLabel lblNombre = new JLabel("Nombre");
		lblNombre.setBounds(42, 59, 46, 14);
		panel.add(lblNombre);
		
		textFieldDir = new JTextField();
		textFieldDir.setBounds(98, 81, 160, 20);
		panel.add(textFieldDir);
		textFieldDir.setColumns(10);
		
		JButton btnAdd = new JButton("Add");
		btnAdd.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				ControladorProveedor cont = new ControladorProveedor();
				cont.insertarProv(getTextFieldCed().getText(), getTextFieldDir().getText(), getTextFieldNombre().getText());
				GesionarProveedor.this.dispose();
			
			}
		});
		btnAdd.setBounds(98, 152, 72, 23);
		panel.add(btnAdd);
		
		JLabel lblDireccion = new JLabel("Direccion");
		lblDireccion.setBounds(42, 84, 46, 14);
		panel.add(lblDireccion);
		
		textFieldNombre = new JTextField();
		textFieldNombre.setColumns(10);
		textFieldNombre.setBounds(98, 54, 160, 20);
		panel.add(textFieldNombre);
		
		JButton btnClose = new JButton("Close");
		btnClose.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				GesionarProveedor.this.dispose();
			}
		});
		btnClose.setBounds(187, 152, 73, 23);
		panel.add(btnClose);
		
		JLabel lblCedula = new JLabel("Cedula");
		lblCedula.setBounds(42, 34, 46, 14);
		panel.add(lblCedula);
		
		textFieldCed = new JTextField();
		textFieldCed.setBounds(98, 26, 160, 20);
		panel.add(textFieldCed);
		textFieldCed.setColumns(10);
	}

	private static class __Tmp {
		private static void __tmp() {
			  javax.swing.JPanel __wbp_panel = new javax.swing.JPanel();
		}
	}

	public JTextField getTextFieldDir() {
		return textFieldDir;
	}

	public void setTextFieldDir(JTextField textFieldDir) {
		this.textFieldDir = textFieldDir;
	}

	public JTextField getTextFieldNombre() {
		return textFieldNombre;
	}

	public void setTextFieldNombre(JTextField textFieldNombre) {
		this.textFieldNombre = textFieldNombre;
	}

	public JTextField getTextFieldCed() {
		return textFieldCed;
	}

	public void setTextFieldCed(JTextField textFieldCed) {
		this.textFieldCed = textFieldCed;
	}
	
	
}
